<template>
	<view class="bbs-item" @click="openBBS">
		<view class="left" :class="item.comments.length>0?'status1':'status0'" v-if="item.bbs_status!=2">
			<view class="num">
				{{item.comments.length}}
			</view>
			<view class="type">
				回答
			</view>
		</view>
		<view class="left status2" v-else>
			<view class="num">
				{{item.comments.length}}
			</view>
			<view class="type">
				已解决
			</view>
		</view>
		<view class="right">
			<view class="top">
				<view class="nick">
					{{item.user.nickname}}
				</view>
				<view class="time">
					{{item._add_time|timeFrom}}
				</view>
			</view>
			<view class="bottom">
				<view class="content">
					{{item.title}}
				</view>
				<view class="tag">
					{{item.categoey.name}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "bbs-item",
		props: ['item'],
		data() {
			return {

			};
		},
		methods: {
			openBBS() {
				uni.vk.navigateTo('/uni_modules/uce-bbs/pages/detail/detail?id=' + this.item._id, false);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bbs-item {
		position: relative;
		width: 100%;
		padding: 30rpx 0;
		display: flex;
		justify-content: flex-start;
		border-bottom: 1px solid #eee;
		background: #fff;

		.left {
			width: 80rpx;
			height: 80rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.num {
				font-size: 30rpx;
			}

			.type {
				font-size: 14rpx;
			}
		}

		.status0 {
			background-color: #f3f3f3;
			border-color: #f3f3f3;
			color: #7b7b7b;

			.num {}

			.type {}
		}

		.status1 {
			color: #0084ff;
			background: rgba(0, 132, 255, 0.1);
			border: none;

			.num {}

			.type {}
		}

		.status2 {
			background: #0084ff;
			border: none;
			color: #fff;

			.num {}

			.type {}
		}


		.right {
			flex: 1;
			// height: 200rpx;
			// background: #007AFF;
			padding-left: 20rpx;

			.top {
				position: relative;
				width: 100%;
				height: 40rpx;
				display: flex;
				color: #999;
				font-size: 24rpx;

				.nick {
					margin-right: 20rpx;
					line-height: 40rpx;
				}

				.time {
					line-height: 40rpx;
				}
			}

			.bottom {
				// display: flex;
				// flex-wrap: wrap;

				.content {
					display: inline;
					font-size: 30rpx;
					line-height: 40rpx;
					color: #11181f;
				}

				.tag {
					display: inline;
					color: #0084ff;
					background: rgba(0, 132, 255, 0.1);
					padding: 5rpx 10rpx;
					margin: 0 10rpx;
					font-size: 24rpx;
				}
			}
		}
	}
</style>
